package com.ruoyi.web.controller.topo;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.vo.TopoVO;
import com.ruoyi.system.service.ITopoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/topo")
public class TopoController extends BaseController {

    @Autowired
    private ITopoService topoService;

    @GetMapping("/getAllTopo")
    public AjaxResult getAllTopo(){
        return success(topoService.selectAll());
    }

    @PostMapping("/addTopo")
    public AjaxResult addTopo(@RequestBody TopoVO topoVO ){
        topoService.addTopo(topoVO);
        return success();
    }

    @GetMapping(value = "/{topoId}")
    public AjaxResult selectById(@PathVariable Long topoId){
        return success(topoService.selectById(topoId));
    }

    @DeleteMapping(value = "/{topoId}")
    public AjaxResult deleteTopo(@PathVariable Long topoId){
        return success(topoService.deleteTopo(topoId));
    }
}
